Hi, I posted this on in the matlab forums but got no response, thought I might find somebody with more relevant knowledge here. Basically. Whilst playing music on Itunes or windows media player, I ran the following code to get and plot 20 seconds of audio data: ai = analoginput('winsound'); Fs=8000; time=20; set(ai,'SamplesPerTrigger',Fs*time) addchannel(ai, 1); tic; start(ai); toc pause(time) data = getdata(ai); data=data/max(data); stop(ai) pause(5) sound(data, Fs) plot((1:length(data))/Fs,data) I put a picture of the output at http://personalpages.manchester.ac.uk/student/Adam.Chapman/soundcard_data.fig As you can see, every now and again the data seems to oscilate around -1. I would have thought that the data couldn't take values <-1, because the "addchannel" command shows: Index: ChannelName: HwChannel: 1 'Mono' 1 InputRange: SensorRange: UnitsRange: Units: [-1 1] [-1 1] [-1 1] 'Volts' I wouldn't think it's a hardware problem, as the sound from my speakers is fine. I've also ran the same code with speakers outputting no sound at all and still get the noise. The data I aquired before did have the music data in it, although when playing back it was distorted by this funny noise signal. Here's what I get from right-clicking the object "ai" in my workspace and selecting "display hardware info": AdaptorName: 'winsound' Bits: 16 Coupling: {'AC Coupled'} DeviceName: 'Microphone (SoundMAX Integrated' DifferentialIDs: [] Gains: [] ID: '0' InputRanges: [-1 1] MaxSampleRate: 96000 MinSampleRate: 5000 NativeDataType: 'int16' Polarity: {'Bipolar'} SampleType: 'SimultaneousSample' SingleEndedIDs: [1 2] SubsystemType: 'AnalogInput' TotalChannels: 2 VendorDriverDescription: 'Windows Multimedia Driver' VendorDriverVersion: '6.0' I'm not sure about the fact that the device name is "microphone", maybe that's default for an audio device. Also I dont know the hardware info is aquired from the device drivers or if they are merely default values. I've also put online the data plot with no sound at: http://personalpages.manchester.ac.uk/student/Adam.Chapman/no_sound_playing.fig Also plotted the data in uint16 format after seeing above the native data type for the sound card is uint16. Again, not sure if this is actual or default. Thanks for any help offered. Adam
sound card output to matlab giving funny noise
Started by ●December 9, 2008