Week 13: Audacity Roger B. Dannenberg Professor of Computer Science - - PDF document

week 13 audacity
SMART_READER_LITE
LIVE PREVIEW

Week 13: Audacity Roger B. Dannenberg Professor of Computer Science - - PDF document

Week 13: Audacity Roger B. Dannenberg Professor of Computer Science and Art Carnegie Mellon University Introduction n Audacity n Audacity Implementation n The Nyquist Plug-in Architecture 2 Carnegie Mellon University 2019 by Roger B.


slide-1
SLIDE 1

1

Week 13: Audacity

Roger B. Dannenberg

Professor of Computer Science and Art Carnegie Mellon University

Carnegie Mellon University

Introduction

n Audacity n Audacity Implementation n The Nyquist Plug-in Architecture

ⓒ 2019 by Roger B. Dannenberg

2

slide-2
SLIDE 2

2

Carnegie Mellon University

Audacity

n Graphical Audio Editor n Cross Platform: Win32, Mac, Linux n Currently for mono and stereo (but more

channels possible)

n Good for large files n Free and Open Source n Active development team

ⓒ 2019 by Roger B. Dannenberg

3

Carnegie Mellon University

Types of Audio Editors

In-Place Non-Destructive

n Original samples are

modified on disk.

n For example:

n Adobe Audition

(CoolEdit) n Original files are left

alone.

n For example:

n Cubase n ProTools n Logic n Digital Performer

ⓒ 2019 by Roger B. Dannenberg

4

slide-3
SLIDE 3

3

Carnegie Mellon University

In-Place, Non-Destructive, and Audacity

n In-Place Features:

n You see results of operations n Conceptually simple: direct manipulation n Precomputes audio: no real-time problems n Non-causal, out-of-time operations possible

n Non-Destructive Features:

n Large files can be handled efficiently n Effect parameters can be adjusted without

undoing other effects n Audacity does In-Place with efficiency.

ⓒ 2019 by Roger B. Dannenberg

5

Carnegie Mellon University

Introduction

n Audacity n Audacity Implementation n The Nyquist Plug-in Architecture

ⓒ 2019 by Roger B. Dannenberg

6

slide-4
SLIDE 4

4

Carnegie Mellon University

The Sequence Data Structure

Get(i, l): Set(i, l): Insert(i, l): Delete(i, l): Retrieve l consecutive samples from the ith sample. Change l consecutive samples from the ith sample. Insert l consecutive samples before the ith sample. Delete l consecutive samples from the ith sample.

ⓒ 2019 by Roger B. Dannenberg

7

Carnegie Mellon University

Our Sequence Implementation

n For some k, split the sequence into blocks

with sizes between k and 2k.

n When editing, always preserve this k-2k

property by rearranging the data within blocks.

n Any Sequence operation can be performed

with this restriction in only constant (disk) time.

ⓒ 2019 by Roger B. Dannenberg

8

slide-5
SLIDE 5

5

Carnegie Mellon University

Index in RAM

Example: Delete(i, l)

1 a-1 a a+1 b-1 b b+1 m-2m-1

sample i sample i+l

Blocks on Disk

ⓒ 2019 by Roger B. Dannenberg

9

Carnegie Mellon University

Index in RAM

Example: Delete(i, l)

1 a-1 a a+1 b-1 b b+1 m-2m-1

sample i sample i+l

Blocks on Disk

ⓒ 2019 by Roger B. Dannenberg

10

slide-6
SLIDE 6

6

Carnegie Mellon University

Index in RAM

Example: Delete(i, l)

1 a-1 a b b+1 m-2m-1 Blocks on Disk

ⓒ 2019 by Roger B. Dannenberg

11

Carnegie Mellon University

Advantages of a Sequence

n Speed (editing operations are fast, taking

constant disk time).

n Easy to implement Undo by reference-

counting the blocks.

n With reference-counting, the same block can

appear in the Sequence more than once, making duplication/loops easy to implement with low storage overhead.

ⓒ 2019 by Roger B. Dannenberg

12

slide-7
SLIDE 7

7

Carnegie Mellon University

Disadvantages of a Sequence

n Each block is stored in a separate file. To move an

audio project from one location to another, hundreds

  • f small files must be moved.

n Soon, Audacity will use SQLite, a single-file, single-

process SQL database that is very efficient with large

  • bjects. E.g. Photoshop uses it for thumbnails and other data –

apparently doing a query to retrieve a thumbnail image is faster than going through directories using ordinary file systems.

n Using SQLite for Audacity projects, we’ll use the

same sequence-of-blocks implementation, but all blocks will be in a single project file which will be an SQLite database.

ⓒ 2019 by Roger B. Dannenberg

13

Carnegie Mellon University

Fast Redisplay

n Sample amplitudes are summarized at two

zoom levels

n And cached at head of blocks on disk n Simplifies implementation n Quite fast in practice

n Avoids scanning actual samples n Only read data that appears on display n Discussion: would it be better to put sample

amplitudes in separate files?

ⓒ 2019 by Roger B. Dannenberg

14

slide-8
SLIDE 8

8

Carnegie Mellon University

Performance Measurements (2001)

20 40 60 80 100 120 140 1 2 4 8 16 32 64 128 256 512

Total File Size (MB) Avg time per edit (ms)

ⓒ 2019 by Roger B. Dannenberg

15

It seems that file caching is in effect up to about 100MB. After that, every edit pays to read from disk, but notice that this is not exponential growth. At 512MB, there seems to be an upper bound or at most slow growth above

  • 120ms. We actually ran out of disk

space doing measurements, so the evidence for slow asymptotic growth is not rock-solid, but it matches our expectation and complexity analysis.

Carnegie Mellon University

Introduction

n Audacity n Audacity Implementation n The Nyquist Plug-in Architecture

ⓒ 2019 by Roger B. Dannenberg

16

slide-9
SLIDE 9

9

Carnegie Mellon University

Running Nyquist Within Audacity

(Virtual) Sound in Audacity Nyquist Sound Result Sound (Virtual) Sound in Audacity Copy Samples

Unit Generators

ⓒ 2019 by Roger B. Dannenberg

17