简体   繁体   English

通过耳机插孔向Android智能手机输入音频?

[英]Audio input to android smartphone through headphone jack?

I'm trying to pass audio into an android phone through the headphone jack from an external player. 我正试图通过外部播放器的耳机插孔将音频传入Android手机。 I am reasonably sure it can be done for two reasons: 我有理由相信它可以有两个原因:

1) The square card reader works by sending its information through the headphone jack, so it can handle information input. 1)方卡读卡器通过耳机插孔发送信息,因此可以处理信息输入。 https://squareup.com/reader https://squareup.com/reader
2) In order to get the audio from the player to the phone, I will be using a normal aux-aux cable, similar to those used connecting a music player to speakers. 2)为了将音频从播放器传到手机,我将使用普通的aux-aux电缆,类似于将音乐播放器连接到扬声器的电缆。 The fact that the audio can be passed to the speakers through a simple two ring cable. 音频可以通过简单的双环电缆传递到扬声器。 I know usually the two rings are used only for output with a third ring for input, but it seems to me this would suggest they are capable of inputting without the third ring. 我知道通常这两个环仅用于输出带有第三个环用于输入,但在我看来,这表明它们能够在没有第三个环的情况下输入。

My problem is there doesn't seem to be any api to deal with input through the headphone jack, and no one seems to know how the square reader works, or deals with the input. 我的问题是似乎没有任何api来处理通过耳机插孔的输入,似乎没有人知道方形阅读器如何工作,或处理输入。 It looks like AudioRecord, http://developer.android.com/reference/android/media/AudioRecord.html , could have some potential to work, but it seems to need the size to be specified ahead of time, which is not ideal. 它看起来像AudioRecord, http://developer.android.com/reference/android/media/AudioRecord.html ,可能有一些潜力可以工作,但它似乎需要提前指定大小,这是不理想的。

So if anyone could help me with any information on AudioRecord and how it works, or an alternative way of dealing with the input, I'd appreciate it. 因此,如果有人能够帮助我处理有关AudioRecord及其工作原理的任何信息,或者另一种处理输入的方法,我会很感激。 Also if someone knows for sure if I am correct in thinking the two ring cable can deal with input, that would also help a lot. 此外,如果有人确定我认为两条环形电缆可以处理输入是否正确,那也会有很大帮助。 Thanks. 谢谢。

SquareUp teardown by North Street Labs is a good point of reference to understand the design of the SquareUp reader. North Street Labs的SquareUp拆解是了解SquareUp阅读器设计的一个很好的参考点。 ( Archived Link ) 存档链接

Audio Recording With a Smartphone will shed some light on the headphone rings and their configuration. 音频录制使用智能手机将揭示耳机铃声及其配置。

BrandonLW's GitHub source code provides the Android source code to record and decode the sound data. BrandonLW的GitHub源代码提供Android源代码来记录和解码声音数据。

HTH HTH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM