{"id":971,"date":"2019-09-23T12:21:25","date_gmt":"2019-09-23T03:21:25","guid":{"rendered":"https:\/\/ahnbk.com\/?p=971"},"modified":"2019-09-23T12:21:25","modified_gmt":"2019-09-23T03:21:25","slug":"python%ec%9c%bc%eb%a1%9c-macos-text-to-speech-%ec%97%94%ec%a7%84-nsspeechsynthesizer-%ec%82%ac%ec%9a%a9%ed%95%b4%eb%b3%b4%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/ahnbk.com\/?p=971","title":{"rendered":"Python\uc73c\ub85c macOS Text to Speech \uc5d4\uc9c4 (NSSpeechSynthesizer) \uc0ac\uc6a9\ud574\ubcf4\uae30"},"content":{"rendered":"\n<p>\ub85c\ubd07\uc774\ub4e0 \ub2e4\ub978 \ubd84\uc57c\uc5d0\uc11c\ub4e0 TTS (Text To Speech) \uc5d4\uc9c4\uc774 \ud544\uc694\ud560 \ub54c\uac00 \uc788\ub294\ub370, \ubcf4\ud1b5\uc740 \uc624\ud508 \uc18c\uc2a4\ub85c \uacf5\uac1c\ub41c \uc800\ud488\uc9c8\uc758 \uc5d4\uc9c4\uc774\ub098, \ud074\ub77c\uc6b0\ub4dc \uc5d4\uc9c4\uc744 \uc0ac\uc6a9\ud558\uace4 \ud55c\ub2e4. \ubb3c\ub860 \uc694\uc998 \ub525\ub7ec\ub2dd \uae30\uc220\uc774 \ub9ce\uc774 \ubc1c\uc804\ud558\uc5ec \ud559\uc2b5 \ud6c4 \uc2e4\uc81c \ubaa9\uc18c\ub9ac\uc640 \ube44\uc2b7\ud55c \uc18c\ub9ac\ub97c \ub0b4\ub294 \uac83\ub3c4 \uac00\ub2a5\ud558\ub2e4\uace4 \ud558\uc9c0\ub9cc, \uadf8\uac74 \ub17c\uc678\ub85c \ud558\uace0&#8230;.<\/p>\n\n\n\n<p>macOS\uc5d0\ub294 NSSpeechSynthesizer\ub77c\ub294 \ud6cc\ub96d\ud55c \ud488\uc9c8\uc758 TTS \uc5d4\uc9c4 &#8211; \uadf8\uac83\ub3c4 \uac70\uc758 \ubaa8\ub4e0 \ub098\ub77c\uc758 \ubaa9\uc18c\ub9ac\uac00 \ud3ec\ud568\ub418\uc5b4 \uc788\ub294 &#8211; \uc774 \ub0b4\uc7a5\ub418\uc5b4 \uc788\ub2e4. \uc774\ub97c \uc0ac\uc6a9\ud558\uae30 \uc704\ud574\uc120 Swift\ub098 ObjectC\ub97c \uc0ac\uc6a9\ud560 \uc218\ub3c4 \uc788\uc9c0\ub9cc, \uc0ac\uc6a9\ud558\uae30 \uc26c\uc6b4 Python\uc744 \uc774\uc6a9\ud574\uc11c \uc0ac\uc6a9\ub3c4 \uac00\ub2a5\ud558\ub2e4. <\/p>\n\n\n\n<p>\uba3c\uc800 \ud544\uc694\ud55c \ud328\ud0a4\uc9c0\ub97c \uc124\uce58\ud55c\ub2e4. \uc774\ub97c \uc704\ud574 Python3, pip3\uac00 \uc124\uce58\ub418\uc5b4 \uc788\uc5b4\uc57c \ud55c\ub2e4. Homebrew (https:\/\/docs.brew.sh\/Installation)\ub97c \uc774\uc6a9\ud558\uba74 \uc27d\uac8c \uc124\uce58 \uac00\ub2a5\ud558\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pip3 install -U pyobjc<\/code><\/pre>\n\n\n\n<p>pyobjc \ubaa8\ub4c8\uc740 Python\uacfc ObjC \uac04 \uc5f0\uacb0\uc744 \uc704\ud55c \uac83\uc774\ub2e4. pyobjc\ub294 \uba54\ud0c0\ubaa8\ub4c8\ub85c \uc774\ub97c \uc124\uce58\ud558\uba74 \uc0ac\uc6a9\uc5d0 \ud544\uc694\ud55c \uac70\uc758 \ubaa8\ub4e0 \ubaa8\ub4c8\uc744 \ub2e4 \uc124\uce58\ud55c\ub2e4.<\/p>\n\n\n\n<p>\uc774\uc81c Python3\ub97c \uc774\uc6a9\ud558\uc5ec \ub2e4\uc74c\uc758 \uc2a4\ud06c\ub9bd\ud2b8\ub97c \uc2e4\ud589\ud574\ubcf8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from AppKit import NSSpeechSynthesizer\n\nspeech = NSSpeechSynthesizer.alloc().initWithVoice_(\"com.apple.speech.synthesis.voice.yuna.premium\")\nspeech.startSpeakingString_(u'\uc548\ub155? \ub9cc\ub098\uc11c \ubc18\uac00\uc6cc\uc694.')<\/code><\/pre>\n\n\n\n<p>\ud55c\uad6d\uc5b4 \uc720\ub098\uc758 \ubaa9\uc18c\ub9ac\ub85c \ub9d1\uc740 \uc74c\uc131\uc744 \ub4e4\ub824\uc904 \uac83\uc774\ub2e4. \uc774\uc678\uc5d0\ub3c4 \uc81c\uc5b4\ub97c \uc704\ud55c \ub2e4\uc591\ud55c \ud568\uc218\ub4e4\uc774 \uc874\uc7ac\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>speech.isSpeaking()\nspeech.stopSpeaking()<\/code><\/pre>\n\n\n\n<p>\uc0ac\uc6a9 \uac00\ub2a5\ud55c \ubaa9\uc18c\ub9ac \ub9ac\uc2a4\ud2b8\ub97c \ud655\uc778\ud558\ub824\uba74 \ub2e4\uc74c\uacfc \uac19\uc774 \uc785\ub825\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>>> NSSpeechSynthesizer.availableVoices()<\/code><\/pre>\n\n\n\n<p>\uace0\ud488\uc9c8\uc758 \ubaa9\uc18c\ub9ac\ub97c \ubbf8\ub9ac \ub2e4\uc6b4\ub85c\ub4dc \ubc1b\uc544\uc57c \ud55c\ub2e4. System Preferences > Accessibility > Speech \uc5d0\uc11c System Voice\ub97c \uc120\ud0dd, Customize \ud56d\ubaa9\uc73c\ub85c \ub4e4\uc5b4\uac00\uba74 \uac01 \ub098\ub77c\ubcc4 \ubaa9\uc18c\ub9ac \ub9ac\uc2a4\ud2b8\uc640 \ub2e4\uc6b4\ub85c\ub4dc \ubc1b\uc744 \uc218 \uc788\ub294 \uccb4\ud06c\ubc15\uc2a4\uac00 \uc874\uc7ac\ud55c\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img data-attachment-id=\"972\" data-permalink=\"https:\/\/ahnbk.com\/?attachment_id=972\" data-orig-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/09\/image.png?fit=1348%2C966&amp;ssl=1\" data-orig-size=\"1348,966\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/09\/image.png?fit=1000%2C717&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/09\/image.png?fit=525%2C376&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/09\/image.png?resize=486%2C348&#038;ssl=1\" alt=\"\" class=\"wp-image-972\" width=\"486\" height=\"348\" srcset=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/09\/image.png?w=1348&amp;ssl=1 1348w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/09\/image.png?resize=1000%2C717&amp;ssl=1 1000w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/09\/image.png?resize=768%2C550&amp;ssl=1 768w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/09\/image.png?w=1050&amp;ssl=1 1050w\" sizes=\"(max-width: 486px) 100vw, 486px\" data-recalc-dims=\"1\" \/><\/figure><\/div>\n\n\n\n<p>\ub05d.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ub85c\ubd07\uc774\ub4e0 \ub2e4\ub978 \ubd84\uc57c\uc5d0\uc11c\ub4e0 TTS (Text To Speech) \uc5d4\uc9c4\uc774 \ud544\uc694\ud560 \ub54c\uac00 \uc788\ub294\ub370, \ubcf4\ud1b5\uc740 \uc624\ud508 \uc18c\uc2a4\ub85c \uacf5\uac1c\ub41c \uc800\ud488\uc9c8\uc758 \uc5d4\uc9c4\uc774\ub098, \ud074\ub77c\uc6b0\ub4dc \uc5d4\uc9c4\uc744 \uc0ac\uc6a9\ud558\uace4 \ud55c\ub2e4. \ubb3c\ub860 \uc694\uc998 \ub525\ub7ec\ub2dd \uae30\uc220\uc774 \ub9ce\uc774 \ubc1c\uc804\ud558\uc5ec \ud559\uc2b5 \ud6c4 \uc2e4\uc81c \ubaa9\uc18c\ub9ac\uc640 \ube44\uc2b7\ud55c \uc18c\ub9ac\ub97c \ub0b4\ub294 \uac83\ub3c4 \uac00\ub2a5\ud558\ub2e4\uace4 \ud558\uc9c0\ub9cc, \uadf8\uac74 \ub17c\uc678\ub85c \ud558\uace0&#8230;. macOS\uc5d0\ub294 NSSpeechSynthesizer\ub77c\ub294 \ud6cc\ub96d\ud55c \ud488\uc9c8\uc758 TTS \uc5d4\uc9c4 &#8211; \uadf8\uac83\ub3c4 \uac70\uc758 \ubaa8\ub4e0 \ub098\ub77c\uc758 \ubaa9\uc18c\ub9ac\uac00 \ud3ec\ud568\ub418\uc5b4 \uc788\ub294 &#8211; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ahnbk.com\/?p=971\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Python\uc73c\ub85c macOS Text to Speech \uc5d4\uc9c4 (NSSpeechSynthesizer) \uc0ac\uc6a9\ud574\ubcf4\uae30&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[52],"tags":[53,232,127,233],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2wXSW-fF","jetpack-related-posts":[],"jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts\/971"}],"collection":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=971"}],"version-history":[{"count":1,"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts\/971\/revisions"}],"predecessor-version":[{"id":973,"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts\/971\/revisions\/973"}],"wp:attachment":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}