Thread Subject: Problem with sound and soundsc on MATLAB 2009b, Mac (Snow Leopard)

Subject: Problem with sound and soundsc on MATLAB 2009b, Mac (Snow Leopard)

From: Aengus

Date: 26 Oct, 2009 07:19:04

Message: 1 of 3

Hi,

I'm having problems auditioning sound signals using the sound and soundsc functions in MATLAB 2009b on Mac Snow Leopard 10.6.1.

I can run the following code to generate a 1 second 440 Hz sine wave at 48 kHz, scaled by 0.5:

fs = 48000;
sig = 0.5*sin(2*pi*(0:(fs-1))*440/fs);

But when I run the code:

sound(sig,fs)

I hear the signal I expect along with some bad buzzing-type artefacts. If I write the signal to a wave file ( using wavwrite(sig,fs,'test.wav') ) and audition it using other audio software on the computer, it sounds perfect.

Has anyone any suggestions as to what might be going on?

Thanks,

Aengus.

Subject: Problem with sound and soundsc on MATLAB 2009b, Mac (Snow Leopard)

From: Aengus

Date: 26 Oct, 2009 08:36:03

Message: 2 of 3

Hi,

Some additional information. This appears to be a problem with Java audio on the Mac.

Some talk in these threads:

http://discussions.apple.com/thread.jspa?messageID=10397960&tstart=0
http://discussions.apple.com/thread.jspa?threadID=1250142&start=0&tstart=0
http://lists.apple.com/archives/java-dev/2009/Oct/msg00151.html .

At the suggestion of a poster in one of the threads, I got the buzzing to stop by running Applications/Utilities/Audio Midi Setup and setting the output audio sampling rate to 44100 Hz. This is only a temporary fix though, until another application changes the sample rate and things get messed up again.

Even with the temporary fix, I still hear a click a few hundred milliseconds into the sound playback, which is not present when using other non-Java applications.

I have seen mention of people going back to an earlier Java version. I don't know if this is a good idea or not... or how likely it is that there will be a proper fix soon.

Cheers,

Aengus.



"Aengus " <aengus@ee.usyd.edu.au> wrote in message <hc3ih8$f94$1@fred.mathworks.com>...
> Hi,
>
> I'm having problems auditioning sound signals using the sound and soundsc functions in MATLAB 2009b on Mac Snow Leopard 10.6.1.
>
> I can run the following code to generate a 1 second 440 Hz sine wave at 48 kHz, scaled by 0.5:
>
> fs = 48000;
> sig = 0.5*sin(2*pi*(0:(fs-1))*440/fs);
>
> But when I run the code:
>
> sound(sig,fs)
>
> I hear the signal I expect along with some bad buzzing-type artefacts. If I write the signal to a wave file ( using wavwrite(sig,fs,'test.wav') ) and audition it using other audio software on the computer, it sounds perfect.
>
> Has anyone any suggestions as to what might be going on?
>
> Thanks,
>
> Aengus.

Subject: Problem with sound and soundsc on MATLAB 2009b, Mac (Snow Leopard)

From: Aengus

Date: 27 Oct, 2009 01:08:02

Message: 3 of 3

For anyone else with this problem, a workaround that's not too bad is:

wavwrite(sig,fs,'temp.wav');
!afplay temp.wav

afplay is a command line soundfile player on OS X.

Cheers,

Aengus.


"Aengus " <aengus@ee.usyd.edu.au> wrote in message <hc3n1j$hkc$1@fred.mathworks.com>...
> Hi,
>
> Some additional information. This appears to be a problem with Java audio on the Mac.
>
> Some talk in these threads:
>
> http://discussions.apple.com/thread.jspa?messageID=10397960&tstart=0
> http://discussions.apple.com/thread.jspa?threadID=1250142&start=0&tstart=0
> http://lists.apple.com/archives/java-dev/2009/Oct/msg00151.html .
>
> At the suggestion of a poster in one of the threads, I got the buzzing to stop by running Applications/Utilities/Audio Midi Setup and setting the output audio sampling rate to 44100 Hz. This is only a temporary fix though, until another application changes the sample rate and things get messed up again.
>
> Even with the temporary fix, I still hear a click a few hundred milliseconds into the sound playback, which is not present when using other non-Java applications.
>
> I have seen mention of people going back to an earlier Java version. I don't know if this is a good idea or not... or how likely it is that there will be a proper fix soon.
>
> Cheers,
>
> Aengus.
>
>
>
> "Aengus " <aengus@ee.usyd.edu.au> wrote in message <hc3ih8$f94$1@fred.mathworks.com>...
> > Hi,
> >
> > I'm having problems auditioning sound signals using the sound and soundsc functions in MATLAB 2009b on Mac Snow Leopard 10.6.1.
> >
> > I can run the following code to generate a 1 second 440 Hz sine wave at 48 kHz, scaled by 0.5:
> >
> > fs = 48000;
> > sig = 0.5*sin(2*pi*(0:(fs-1))*440/fs);
> >
> > But when I run the code:
> >
> > sound(sig,fs)
> >
> > I hear the signal I expect along with some bad buzzing-type artefacts. If I write the signal to a wave file ( using wavwrite(sig,fs,'test.wav') ) and audition it using other audio software on the computer, it sounds perfect.
> >
> > Has anyone any suggestions as to what might be going on?
> >
> > Thanks,
> >
> > Aengus.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
java Aengus 26 Oct, 2009 04:39:03
mac Aengus 26 Oct, 2009 03:24:06
sound Aengus 26 Oct, 2009 03:24:06
snow leopard Aengus 26 Oct, 2009 03:24:06
2009b Aengus 26 Oct, 2009 03:24:06
rssFeed for this Thread

Contact us at files@mathworks.com