1

I have a raw data file of a sound recording, with each sample stored as a 16 bit short. I want to play this file through Redhawk.

I have a file_source_s connected to AudioSink like so: file_source_s_1 component connected to AudioSink

I was expecting to hear sound from my speakers when starting these components. But when I start both components, I cannot hear any sound.

Here are the file_source_s properties values:

  • filename: name
  • itemsize: 2
  • repeat: true
  • seek: true
  • seek_point: 0
  • whence: SEEK_SET

I know:

  • the problem is not AudioSink. I have tested the AudioSink with the signal generator (SigGen) and I could hear sound through my speakers.
  • file_source_s is finding the file. When I put in a non-existent file name, file_source_s gives the "No such file or directory" error. I can also see the first 1024 bytes of the file when I plot the short_out port, but the plot does not update.

1 Answers1

3

The AudioSink component uses the information from the received SRI (Signal Related Information) in order to determine the audio's sample rate. This is seen here from line 156 of the AudioSink component:

int sample_rate = static_cast<int>(rint(1.0/current_sri.xdelta));

It receives the SRI from downstream components, in this case, file_source_s.

The component file_source_s is part of the gnuhawk component package. The GNUHAWK library provides software that enables a GNU Radio block to be integrated into the REDHAWK software framework. Since SRI is a REDHAWK construct and not present in GNURADIO, it does not appear as though the file_source_s block gathers enough information via properties to represent the correct xdelta / sample rate for the audio file.

I'd recommend using a pure REDHAWK component like DataReader which takes in as a property the sample rate.

Youssef Bagoulla
  • 1,229
  • 1
  • 7
  • 16
  • Thanks for the quick and well-written response. The input file I'm reading is of type short, but DataReader seems to only be able to read type float. Is it possible to configure DataReader to read type short? – five_dollar_shake Feb 17 '15 at 16:31
  • I just tried to use DataReader to read floats from a file. I did not hear any sound. I also tried to plot the data coming out of DataReader and I did not see any data flowing. – five_dollar_shake Feb 17 '15 at 16:40
  • It looks like DataReader does not use the SRI either. I used the sourcesocket component from GNUHAWK because it has a SRI property. I wrote a simple Python script to send the input data to the socket being listened on by sourcesocket. In the properties of sourcesocket, I set the xdelta of SRI to the period of the input data. Now I can hear the sound through my speakers when I start AudioSink. It appears to be working now. Thanks! – five_dollar_shake Feb 17 '15 at 17:22