Toni
unread,May 16, 2019, 4:46:30 AM5/16/19You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I'm a little desperate.
I2S seems not to work.
If I try to play a sound with audioTrack. In the raspberry pi 3 it works without problems, but if I execute it in imx7d it gives me the following error:
audio_hw_primary: card 0, port 0 device 0x1000000
audio_hw_primary: rate 48000, channel 2 period_size 0xc0
audio_hw_primary: can not open pcm_out driver 0: can not set hw params: Invalid argument
The same thing happens with an i2s microphone
This is the code:
final AudioDeviceInfo audioOuputDevice = findAudioDevice(AudioManager.GET_DEVICES_OUTPUTS, AudioDeviceInfo.TYPE_BUS);
int mBufferSize = AudioTrack.getMinBufferSize(44100, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
AudioFormat audioOutputFormat = new AudioFormat.Builder()
.setChannelMask(AudioFormat.CHANNEL_IN_MONO)
.setEncoding(AudioFormat.ENCODING_PCM_16BIT)
.setSampleRate(44100)
.build();
audioTrack = new AudioTrack.Builder()
.setAudioFormat(audioOutputFormat)
.setBufferSizeInBytes(mBufferSize * 2)
.setTransferMode(AudioTrack.MODE_STREAM)
.build();
audioTrack.setPreferredDevice(audioOuputDevice);
audioTrack.setPlaybackRate(44100);
audioTrack.setVolume(AudioTrack.getMaxVolume());