Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I apologize if this has been covered before but I am required to study Octave at my university. The way they're going through the exercises, they already assume that sound() works with Octave out of the box. However that does not seem to be the case. I am doing a distance learning course so I can't get direct help from the university on this.

Could anyone tell me how I could play audio of, say, a sampled sine wave. My university teaches sound(x, 8000) for example where x contains the calculations for the sine wave and 8000 is the sampling rate.

I have sox installed but I have no idea how sox and Octave work together, nor do I know if there is any other function I can use instead of sound().

If there is a solution, could you please treat me as a noob and tell me how to get it working step-by-step?

I'm on OS X Mountain Lion, not sure if that helps.

I'd really appreciate any kind of help that you can give me on this.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

This is what I've found out.

sound() does not work in Octave anymore. It hasn't worked for a long time. So instead one can use the wavwrite() function with its arguments.

wavwrite(y, filename)
wavwrite(y, fs, filename)
wavwrite(y, fs, bits, filename)

Where y is the sound, fs is the sample rate, bits is bits per sample and filename is the name of the file in single or double quotes.

Once the file is saved in the "home" folder for Octave, you can play the sound using your media player of choice.

Hope this helps.

share|improve this answer
playaudio(name, ext)

Plays the audio file "name.ext".

Assuming you have a vector 'x', which contains the audio in question, you can also use

playaudio(x)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.