2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Raspberry Pi PicoでGarageBand(ソフトウエア音源)を鳴らす

Posted at

pico-sdkの中身にtinyUSBのサンプルにmidi_testがあり、USB経由のmidi出力をMacのGarageBandのピアノを鳴らすことができました。

## tinyusbのmidi_testサンプルプログラムをコピーする Getting started with Raspberry Pi Picoの通り、picoディレクトリ配下にpico-sdkがある前提で説明します。
$ cp -r pico-sdk/lib/tinyusb/examples/device/midi_test .
$ cd midi_test
$ cp ../pico-sdk/external/pico_sdk_import.cmake .

CMakeList.txtを作成する

cmake_minimum_required(VERSION 3.13)
include(pico_sdk_import.cmake)
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
project(${PROJECT})
pico_sdk_init()
add_executable(${PROJECT}
    src/main.c
    src/usb_descriptors.c
)
pico_enable_stdio_usb(${PROJECT} 0)
pico_enable_stdio_uart(${PROJECT} 1)
pico_add_extra_outputs(${PROJECT})
target_link_libraries(${PROJECT} pico_stdlib tinyusb_device tinyusb_board)
include_directories(${PROJECT} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src)

ディレクトリ構成

pico-sdk
midi_test
├── CMakeLists.txt
├── Makefile
├── pico_sdk_import.cmake
└── src
    ├── main.c
    ├── tusb_config.h
    └── usb_descriptors.c

ビルド

$ mkdir build
$ cd build
$ cmake ..
$ make

テスト

midi_test.uf2が作成されるので、Raspberry Pi Picoへコピーする。
Raspberry Pi PicoがMIDIコントローラになり、MacのGarageBand(ソフトウエア音源)を鳴らすことができます。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?