Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating echo in audio file

Kunal Saxena
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm trying to create echo in audio file(.wav)..i encountered a java code for the code,to create an echo, it takes each sample(each sample of two bytes) and passes the position of the first byte of the sample to a func getSamples(buffer,position),buffer is the byte array and position is the position of the 1st byte of the sample...
In the getSamples() function.....
public static short getSample(byte[] buffer, int position) {
return (short) (((buffer[position + 1] & 0xff) << 8) | (buffer[position] & 0xff));
i can't understand what it is doing as the 2nd byte of each sample,i.e. buffer[position+1] is 0 and it returns the same value as that of the 1st byte of each sample...still if i delete the code in this function it does not create an echo..Also,what is the use of 0xff(masking) with respect to this code..if i delete 0xff,this code does not works.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic