Book Image

Panda3D 1.7 Game Developer's Cookbook

Book Image

Panda3D 1.7 Game Developer's Cookbook

Overview of this book

Table of Contents (20 chapters)
Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Reading audio data from a microphone


Microphones and audio processing have become a fixed part of game development, not only for music and singing games, but also for team based action and strategy titles, which require multiple players to coordinate their actions in order to succeed. It doesn't matter whether you want to make your game voice controlled, detect the pitch of someone singing or implement a voice chat, you will almost always need to get access to an audio device. In this short recipe, you will learn how to open an audio source for recording and do some simple signal processing on the received audio data.

Getting ready

Set up a new Panda3D Python project as shown in Setting up the game structure found in Chapter 1 before going on with this recipe.

How to do it...

Complete these tasks to enable and handle input from a microphone:

  1. Open Application.py and replace its contents with the following code:

    from direct.showbase.ShowBase import ShowBase
    from panda3d.core import *
    import audioop...