Author Topic: ALSA bit-perfect output  (Read 79239 times)

Offline kryoz

  • Newbie
  • *
  • Posts: 18
  • Karma: +2/-0
    • View Profile
Re: ALSA bit-perfect output
« Reply #60 on: January 25, 2014, 09:47:04 am »
I found the problem, it didn't have relation to the i2s module. There was an error compiling bcmdhd module for wi-fi.

Vanderdrux

  • Guest
Re: ALSA bit-perfect output
« Reply #61 on: February 03, 2014, 06:32:37 am »
dear all,
    1st off all thank you for your sharing.

I'm interested to make CT able to play with audio for metering, recording, and study.
My 1st goal have been Jackd and ardour working perfect after a long session of source code compile directly on the CT.
With obiouvsly not much filter applied at same time I can use them without have any xrun errors and re-patch audio output to headphone with nice audio quality. No pop, no glitch, no artefacts.

I would like understand which kind of possibilities of audio input can we use with CT.

For analog to be honest I've not yet found the right config but changing script.bin I've made alsa able to have all inputs visible on alsa mixer (various mics, line IN, line ADC, etc...). Jackd can route input (analog noise around -60db -50db of TP). I've not connected nothing yet to the right jumper.

did you experts had some experience about i2s input or only i2s output?
do you have some ideas to have digital input, maybe also more than 2ch please? Maybe with also something like AES/EBU to i2s and so on.

much appreciated any your answer.
apologies for my rough english.

have a nice time
« Last Edit: February 03, 2014, 12:35:14 pm by Vanderdrux »

mhelin

  • Guest
Re: ALSA bit-perfect output
« Reply #62 on: February 11, 2014, 04:33:33 pm »
How is the multichannel output in i2s driver, is it supported? The patch seems to enable all SDOx output data pins, but guess that is not enough.

Offline soundcheck

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
    • View Profile
Re: ALSA bit-perfect output
« Reply #63 on: February 18, 2014, 09:52:17 am »
Nikkov.

Great work. I'll try introduce the patch in the ArchLinux project , if you don't mind. It would be even better if patwood or sunxi would take the patch straight into their
kernel work.

How difficult would it be to patch the SPDIF sources?? SPDIF still doesn't come with 24bit, which is a pity. I looked a little bit into the SPDIF code and into your patch . (I'm not an experienced programmer.) A lot of similarities. I guess it shouldn't be too complex to get SPDIF up 2 24bit. 24bit is IMO more important than having high samplerates All high samplerate material is 24bit anyhow. So 24bit comes first.


Thx for your efforts.
« Last Edit: February 18, 2014, 10:17:42 am by soundcheck »

Offline soundcheck

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
    • View Profile
Re: ALSA bit-perfect output
« Reply #64 on: February 18, 2014, 10:52:21 am »
Hmmh.

I also ran into this

Code: [Select]
ERROR: "sunxi_iis" [sound/soc/sunxi/i2s/sunxi-sndi2s.ko] undefined!
ERROR: "sunxi_iis" [sound/soc/sunxi/i2s/sunxi-i2sdma.ko] undefined!

on patwoods kernel.

I set CONFIG_SND_SUNXI_SOC_CODEC=m with make oldconfig.

Anything else I'd have to consider?
 

Offline soundcheck

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
    • View Profile
Re: ALSA bit-perfect output
« Reply #65 on: February 18, 2014, 11:18:45 am »
Hmmh.

I changed the module config to "Y" now with menuconfig. Compiled again.

and ended up with this:

Code: [Select]
0 [sunxisndi2s    ]: sunxi-sndi2s - sunxi-sndi2s
                      sunxi-sndi2s

;)

cu6apum

  • Guest
Re: ALSA bit-perfect output
« Reply #66 on: March 09, 2014, 06:51:42 pm »
The patch file has been lost....
nikkov, what's there beyond clock source fix you've posted in the beginning?
« Last Edit: March 11, 2014, 05:54:58 pm by cu6apum »

Offline nikkov

  • Newbie
  • *
  • Posts: 39
  • Karma: +2/-0
    • View Profile
Re: ALSA bit-perfect output
« Reply #67 on: March 12, 2014, 01:21:35 am »
I attached new patch for I2S.
Changes:
1. Cleaning unused code
2. Support as loadable module compilation
3. Support slave mode

For defination master/slave mode I used script.bin:
Code: [Select]
[i2s_para]
i2s_used = 1
i2s_slave = 1
i2s_channel = 2
i2s_bclk = port:PB06<2><1><default><default>
i2s_lrclk = port:PB07<2><1><default><default>
i2s_dout0 = port:PB08<2><1><default><default>
i2s_dout1 =
i2s_dout2 =
i2s_dout3 =
i2s_din = port:PB12<2><1><default><default>
i2s_clk_sel = port:PB05<1><0><default><1>
i2s_clk_div0 = port:PB09<1><0><default><1>
i2s_clk_div1 = port:PB10<1><0><default><1>

i2s_clk_sel used for external master clock selector (1=22.5792MHz, 0=24.576MHz)
i2s_clk_div0, i2s_clk_div1 used for bitclock divider:
1, 1 for 44100/48000
1, 0 for 88200/96000
0, 0 for 176400/192000

Simple description of my CT adapter for slave mode:

block_sch by nikkov55, on Flickr

and adapter:

CT_adapter by nikkov55, on Flickr
« Last Edit: March 12, 2014, 01:32:23 am by nikkov »

TBM

  • Guest
Re: ALSA bit-perfect output
« Reply #68 on: March 12, 2014, 02:05:55 am »
Nice Nikkov!  :)

What can you say soundwize regarding using your 2 clock solution vs "only" using the internal clock for bit-perfect I2S on 44.1KHz and 48KHz (and multiples)?

Cheers,
Tom

Offline nikkov

  • Newbie
  • *
  • Posts: 39
  • Karma: +2/-0
    • View Profile
Re: ALSA bit-perfect output
« Reply #69 on: March 12, 2014, 02:23:53 am »
Nice Nikkov!  :)

What can you say soundwize regarding using your 2 clock solution vs "only" using the internal clock for bit-perfect I2S on 44.1KHz and 48KHz (and multiples)?

Cheers,
Tom

My current setup suitable only for code testing. So I can't compare sound quality. But I know that sound from clock derived from PLL potentially lower quality.

glt

  • Guest
Re: ALSA bit-perfect output
« Reply #70 on: March 29, 2014, 02:22:12 am »
First post here. Good work for enabling I2S. It seems the patch requires compilation of the source. Is there hope for those of us code-challenged to have this incorporated into a release?


cu6apum

  • Guest
Re: ALSA bit-perfect output
« Reply #71 on: March 30, 2014, 05:35:08 am »
There's nothing criminal in compiling the code, there are several toolchains ready-to-go, from linux packages to even Mac OS. One day of pain, and you're in control.
In any case, you need to brush the kernel seriously for best audio results. I have removed tons of unused stuff, shrinking the kernel 6x in size.

isirps

  • Guest
Re: ALSA bit-perfect output
« Reply #72 on: April 01, 2014, 07:02:30 am »
any idea how to send 24/96 stereo through usb dac? It plays mp3, but does not play flac.

lubuntu desktop cubietruck. loaded snd-usb-audio modue and mpd...

Offline Punith

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: ALSA bit-perfect output
« Reply #73 on: June 17, 2014, 08:23:59 am »
Hi nikkov,

In our A20 custom board we are using i2s sound card , for that we are using TI external codec TLV320AIC3100.
In Kernel tree we have alsa driver for TLV320AIC3100.
vim linux-sunx/sound/soc/codecs/tlv320aic3x.c

So i tried by writing Asoc machine driver linking alsa external codec to  sunxi-i2s soundcard and compiled successfully and by  insmod also working fine.but once i play any audio which is not yet worked.

Here i am attaching my machine driver code ,scripts and schematics and log once i play audio though i2s

Log:
root@localhost:/# mplayer -ao alsa:device=hw=2.0 /Waka.mp4
Warning unknown option skin at line 101
MPlayer2 UNKNOWN (C) 2000-2011 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing /Waka.mp4.
Detected file format: QuickTime/MPEG-4/Motion JPEG 2000 format (libavformat)
[lavf] stream 0: audio (aac), -aid 0, -alang und
[lavf] stream 1: video (h264), -vid 0
VIDEO:  [H264]  1920x1080  24bpp  24.000 fps  3714.5 kbps (453.4 kbyte/s)
Clip info:
 major_brand: mp42
 minor_version: 0
 compatible_brands: isomavc1mp42
 creation_time: 2010-06-03 23:14:31
Load subtitles in /
vo: couldn't open the X11 display ()!
Error opening/initializing the selected video_out (-vo) device.
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 125.6 kbit/8.90% (ratio: 15695->176400)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   1.7 (01.6) of 210.6 (03:30.5)  4.1% $<3>


MPlayer interrupted by signal 2 in module: unknown

Exiting... (Quit)


DMESG log:
[SWITCH] sun7i_sndi2s_hw_params,line:131,audio_format:1,SND_SOC_DAIFMT_DSP_A:4
[SWITCH] sun7i_sndi2s_hw_params,line:133,signal_inversion:1,signal_inversion<<8:256,SND_SOC_DAIFMT_IB_NF:768
[SWITCH] sun7i_sndi2s_hw_params,line:135,i2s_master:4,i2s_master<<12:16384,SND_SOC_DAIFMT_CBM_CFM:4096
play:sun7i_i2sdma.c::func:sun7i_pcm_hw_params(line:261)
play DMA_OP_STOP:sun7i-i2sdma.c::func:sun7i_pcm_hw_free(line:382)

My i2s soundcard is working fine, i am getting mclk,bclk  but not able invoke the dac.

Kindly help me. How can i solve this.

Regards
Punith

Offline nikkov

  • Newbie
  • *
  • Posts: 39
  • Karma: +2/-0
    • View Profile
Re: ALSA bit-perfect output
« Reply #74 on: June 18, 2014, 08:04:37 am »
Hi nikkov,

In our A20 custom board we are using i2s sound card , for that we are using TI external codec TLV320AIC3100.
In Kernel tree we have alsa driver for TLV320AIC3100.
vim linux-sunx/sound/soc/codecs/tlv320aic3x.c
...
Hi, Punith

Sorry, I have no experience developing drivers for linux, but in your case may be need check codecs initialisation code and working I2C control bus?
And I checked only I2S mode, PCM mode not tested!

Nikolay