voice-recording-visualizer, 用于Android的麦克风输入的简单可视化工具

分享于 

4分钟阅读

GitHub

  繁體 雙語
Simple Visualizer from mic input for Android.
  • 源代码名称:voice-recording-visualizer
  • 源代码网址:http://www.github.com/tyorikan/voice-recording-visualizer
  • voice-recording-visualizer源代码文档
  • voice-recording-visualizer源代码下载
  • Git URL:
    git://www.github.com/tyorikan/voice-recording-visualizer.git
    Git Clone代码到本地:
    git clone http://www.github.com/tyorikan/voice-recording-visualizer
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/tyorikan/voice-recording-visualizer
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    语音记录可视化工具

    LicenseDownloadAndroid Arsenal

    用于Android的麦克风输入的简单可视化工具。

    用法

    
     @Override 
    
    
     protected void onCreate(Bundle savedInstanceState) {
    
    
     super.onCreate(savedInstanceState);
    
    
    . . .
    
    
     VisualizerView visualizerView = (VisualizerView) findViewById(R.id.visualizer);
    
    
    
     RecordingSampler recordingSampler = new RecordingSampler();
    
    
     recordingSampler.setVolumeListener(this);//for custom implements
    
    
     recordingSampler.setSamplingInterval(100);//voice sampling interval
    
    
     recordingSampler.link(visualizerView);//link to visualizer
    
    
    
     recordingSampler.startRecording();
    
    
     }
    
    
    
     @Override
    
    
     protected void onPause() {
    
    
     mRecordingSampler.stopRecording();
    
    
     super.onPause();
    
    
     }
    
    
    
     @Override 
    
    
     protected void onDestroy() { 
    
    
     mRecordingSampler.release();
    
    
     super.onDestroy(); 
    
    
     } 
    
    
    
    

    VisualizerView

    
    <com.tyorikan.voicerecordingvisualizer.VisualizerView
    
    
     android:id="@+id/visualizer"
    
    
     android:layout_width="100dp"
    
    
     android:layout_height="100dp"
    
    
     android:background="@android:color/black"
    
    
     app:numColumns="4"
    
    
     app:renderColor="@color/renderColor"
    
    
     app:renderRange="top"/>
    
    
    
    

    VisualizerView attrs

    Params格式值
    numColumns整型可视化工具列( ex。 520100 )
    renderColor颜色可视化工具颜色( 如 #EFEFEF@color/light_blue )
    renderRangeenum渲染方向 top (default)bottomboth
    renderType标志呈现类型 bar (default)pixelfade

    演示

    IMAGE demo

    示例

    Gradle

    repositories {
     jcenter()
    }
    dependencies {
     compile 'com.tyorikan:voice-recording-visualizer:1.0.3@aar'}

    许可证

    
    Copyright 2015 tyorikan
    
    
    
    Licensed under the Apache License, Version 2.0 (the"License");
    
    
    you may not use this file except in compliance with the License.
    
    
    You may obtain a copy of the License at
    
    
    
     http://www.apache.org/licenses/LICENSE-2.0
    
    
    
    Unless required by applicable law or agreed to in writing, software
    
    
    distributed under the License is distributed on an"AS IS" BASIS,
    
    
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    
    
    See the License for the specific language governing permissions and
    
    
    limitations under the License.
    
    
    
    

    vis  输入  Visualizer